<template>
  <el-form-item label="数据过滤">
    <el-button
      @click="editJsx"
      type="primary"
      plain
      size="mini"
      icon="el-icon-s-open"
    >
      设置
    </el-button>
  </el-form-item>
</template>

<script>
import monacoEditor from "./hlTableList/monacoEditor/index.js";
import basicmixins from "./basicmixins";
const template = `/**
 * 业务或字典的数据过滤函数
 * @data 接口返回的数据
 * @returns 用于组件的渲染 返回值必须是集合
 */
function parseData(data) {
    return data
}`;
export default {
  mixins: [basicmixins],
  data() {
    return {};
  },
  methods: {
    editJsx() {
      let jsx = this.value.__config.parseDataJsx || template;
      monacoEditor.showEdit(decodeURIComponent(jsx)).then((res) => {
        this.value.__config.parseDataJsx = encodeURIComponent(res);
      });
    },
  },
};
</script>

<style scoped lang="scss">
</style>

